package com.hhq.demo.utils;

import com.hhq.demo.bean.User;

import javax.servlet.http.HttpSession;

/**
 *
 * @author HHQ
 * 操作session域中用户的信息
 */
public class UserUtil {
    public static String getUserName(HttpSession session){
        return (String) session.getAttribute("adminUsername");
    }

    public static String getUserPhone(HttpSession session){
        return (String) session.getAttribute("userPhone");
    }

    public static String getUserSms(HttpSession session,String userPhone){
        return (String) session.getAttribute(userPhone);
    }

    public static void setUserSms(HttpSession session,String userPhone, String code){
        session.setAttribute(userPhone,code);
    }

    public static void setWxUser(HttpSession session, User user) {
        session.setAttribute("wxUserInfo",user);
    }

    public static User getWxUserInfo(HttpSession session){
        return (User) session.getAttribute("wxUserInfo");
    }

}
